/************************************************************************
 File:			Master.h
 Author:		Justin England
 Class:			CSC 470
 Instructor:	Dr. Penaloza
 Date:			
 Description:	Header file to define Master class that will
				emulate a device on an ethernet connected network
 
 
 Known bugs/missing features:
 
 Modifications:
 Date                Comment            
 ----    ------------------------------------------------
 ************************************************************************/

#ifndef _MASTER_H_
#define _MASTER_H_

#include <QtGui>
#include "Ethernet.h"

class QTimer;
class Ethernet;

class Master : public QObject
{
	Q_OBJECT
	
public:
	Master(int, int);					// constructor
	~Master();							// destructor
	
	void attachToEthernet(Ethernet *);	// get pointer of ethernet object
	void start(void);					// start the device on ethernet
	void rxPacket(void);				// update rxPackets

	
	QTimer *sendPacketTimer;

	
private slots:	

	void txPacket(void);				// generates packet at random times
	
private:
	
	int totalMasters;				// total number of masters on ethernet
	int thisMaster;					// the # for this master

	int txPackets;					// packets transmitted for this master
	int rxPackets;					// packets received for this master
	int collisions;					// collisions for this master
	
	Ethernet *ethernetPointer;

};


#endif /* _MASTER_H_ */
